package com.macro.mall.demo2.controller;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.demo2.service.PmsProductService;
import com.macro.mall.model.PmsProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：贾维斯
 * @Description: 描述
 * @name：PmsProductController
 * @Date：2024/10/20 15:36
 */
@RestController
@RequestMapping("/brand")
public class PmsProductController4 {
    @Autowired
    private PmsProductService pmsProductService;

    @GetMapping("/aaa")
    public String test1() {
        System.out.println("111");
        return "1";
    }

    /**
     * 获取某品牌下的商品信息
     * @param brandId
     * @param pageNum
     * @param pageSize
     * @return
     */

    @GetMapping("/productList")
    public CommonResult<CommonPage<PmsProduct>> pmsProductList(
            @RequestParam Integer brandId,
             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
             @RequestParam(value = "pageSize",defaultValue = "2") Integer pageSize) {
        CommonPage<PmsProduct> page = pmsProductService.pmsProductList(brandId,pageNum,pageSize);
        return CommonResult.success(page);
    }




}
